function MyMethodDecorator(str: string) {
  console.log('MyMethodDecorator run');
  return (targetClassPrototype: any, methodName: string, methodDescr: PropertyDescriptor) => {
    console.log('MyMethodDecorator return run');
    // 运行时设置拦截器 做一些操作
    const _methodDescr = methodDescr.value;
    methodDescr.value = function (...args: any[]) {
      console.log('我是methodDescr执行前运行的', this);
      _methodDescr.call(this, ...args);
      console.log('我是methodDescr执行后运行的');
    };
  };
}

class RoleService {
  public roleName: string = 'admin';
  constructor() {}

  @MyMethodDecorator('run decorator method')
  DistribRoles(...args: any[]) {
    // 分配角色
    console.log(this, '分配角色... 参数是', ...args);
  }
}

const instance = new RoleService();
instance.DistribRoles(1, 2, 3);
instance.DistribRoles(1, 2, 3);
